<template>
  <div>
    <h1>son</h1>
    <GrandSon ref="grandson" />
  </div>
</template>

<script>
import GrandSon from "./GrandSon";
export default {
  name: "Son",
  props: [""],
  data() {
    return {
      msg: "这是子组件！！"
    };
  },

  components: {
    GrandSon
  },

  computed: {},

  beforeMount() {},

  mounted() {
    console.log(this.$refs);
    // this.$parent 可以获取当前组件的父组件，结果是一个对象  父传子
    console.log(this.$parent.aaa);
    // this.$children 可以获取当前组件的所有子组件，结果数组  子传父
    console.log(this.$children);
    console.log(this.$children[0].aaa);
  },

  methods: {
    sum(a, b) {
      console.log(a + b);
    }
  },

  watch: {}
};
</script>
<style lang='' scoped>
</style>